package com.jay.media.kit

import android.annotation.SuppressLint
import android.content.Context
import android.os.Build

/**
 * @author xuzhou4
 * @date 2021/11/29
 */
@SuppressLint("StaticFieldLeak")
object ColorUtils {

    private lateinit var sContext: Context

    fun init(context: Context) {
        this.sContext = context.applicationContext
    }

    fun getColor(colorId: Int): Int {
        return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            sContext.getColor(colorId)
        } else {
            sContext.resources.getColor(colorId)
        }
    }
}